package com.racer.observer.observable;
import java.util.*;
public class CurrentConditionsDisplay implements Observer,DisplayElement{
	private float temperature;
	private float humidity;
	private Observable weatherData;
	public CurrentConditionsDisplay(Observable weatherData){
		this.weatherData=weatherData;
		weatherData.addObserver(this);
	}

	public void update(Observable obs,Object arg){
		if(obs instanceof WeatherData){
			WeatherData weatherData=(WeatherData)obs;
			this.temperature=weatherData.getTemperature();
			this.humidity=weatherData.getHumidity();
			display();
		}

	}

	public void display(){
		System.out.println("Current conditions: "+temperature+"F degrees and "+humidity+"% humidity");
	}
}
